.class public Lcom/xiaomi/notes/CustomCheckListEditText;
.super Landroid/widget/EditText;
.source "CustomCheckListEditText.java"


# instance fields
.field private activity:Lcom/xiaomi/notes/NoteEditActivity;

.field private blnCheckFlag:Z

.field private objCheck:Landroid/widget/ImageView;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 35
    invoke-direct {p0, p1}, Landroid/widget/EditText;-><init>(Landroid/content/Context;)V

    .line 36
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 31
    invoke-direct {p0, p1, p2}, Landroid/widget/EditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 32
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 27
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/EditText;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 28
    return-void
.end method

.method static synthetic access$000(Lcom/xiaomi/notes/CustomCheckListEditText;)Z
    .locals 1
    .parameter "x0"

    .prologue
    .line 18
    iget-boolean v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->blnCheckFlag:Z

    return v0
.end method


# virtual methods
.method public getCheckFlag()Z
    .locals 1

    .prologue
    .line 56
    iget-boolean v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->blnCheckFlag:Z

    return v0
.end method

.method protected onCreateContextMenu(Landroid/view/ContextMenu;)V
    .locals 3
    .parameter "menu"

    .prologue
    const/4 v2, 0x0

    .line 61
    const/4 v0, 0x0

    .line 62
    .local v0, id:I
    iget-boolean v1, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->blnCheckFlag:Z

    if-eqz v1, :cond_0

    .line 63
    const v0, 0x7f050063

    .line 67
    :goto_0
    invoke-interface {p1, v2, v2, v2, v0}, Landroid/view/ContextMenu;->add(IIII)Landroid/view/MenuItem;

    move-result-object v1

    new-instance v2, Lcom/xiaomi/notes/CustomCheckListEditText$1;

    invoke-direct {v2, p0}, Lcom/xiaomi/notes/CustomCheckListEditText$1;-><init>(Lcom/xiaomi/notes/CustomCheckListEditText;)V

    invoke-interface {v1, v2}, Landroid/view/MenuItem;->setOnMenuItemClickListener(Landroid/view/MenuItem$OnMenuItemClickListener;)Landroid/view/MenuItem;

    .line 75
    invoke-super {p0, p1}, Landroid/widget/EditText;->onCreateContextMenu(Landroid/view/ContextMenu;)V

    .line 76
    return-void

    .line 65
    :cond_0
    const v0, 0x7f050062

    goto :goto_0
.end method

.method protected onFocusLost()V
    .locals 2

    .prologue
    .line 175
    invoke-super {p0}, Landroid/widget/EditText;->onFocusLost()V

    .line 176
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v0}, Lcom/xiaomi/notes/NoteEditActivity;->getWindow()Landroid/view/Window;

    move-result-object v0

    const/16 v1, 0x15

    invoke-virtual {v0, v1}, Landroid/view/Window;->setSoftInputMode(I)V

    .line 179
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    if-eqz v0, :cond_0

    .line 180
    invoke-virtual {p0}, Lcom/xiaomi/notes/CustomCheckListEditText;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_1

    .line 181
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 186
    :cond_0
    :goto_0
    return-void

    .line 183
    :cond_1
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_0
.end method

.method public onKeyUp(ILandroid/view/KeyEvent;)Z
    .locals 4
    .parameter "keyCode"
    .parameter "event"

    .prologue
    .line 102
    packed-switch p1, :pswitch_data_0

    .line 122
    :cond_0
    :goto_0
    invoke-super {p0, p1, p2}, Landroid/widget/EditText;->onKeyUp(ILandroid/view/KeyEvent;)Z

    move-result v2

    return v2

    .line 104
    :pswitch_0
    invoke-virtual {p0}, Lcom/xiaomi/notes/CustomCheckListEditText;->getText()Landroid/text/Editable;

    move-result-object v2

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v2

    if-eqz v2, :cond_0

    .line 105
    iget-object v2, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v2, p0}, Lcom/xiaomi/notes/NoteEditActivity;->getChildViewIndex(Landroid/view/View;)I

    move-result v0

    .line 106
    .local v0, index:I
    iget-object v2, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v2, v0}, Lcom/xiaomi/notes/NoteEditActivity;->deleteChildView(I)V

    .line 107
    iget-object v2, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    const/4 v3, 0x1

    sub-int v3, v0, v3

    invoke-virtual {v2, v3}, Lcom/xiaomi/notes/NoteEditActivity;->getPreEditText(I)Lcom/xiaomi/notes/CustomCheckListEditText;

    move-result-object v1

    .line 108
    .local v1, v:Lcom/xiaomi/notes/CustomCheckListEditText;
    if-eqz v1, :cond_0

    .line 109
    iget-object v2, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v2}, Lcom/xiaomi/notes/NoteEditActivity;->getWindow()Landroid/view/Window;

    move-result-object v2

    const/16 v3, 0x15

    invoke-virtual {v2, v3}, Landroid/view/Window;->setSoftInputMode(I)V

    .line 112
    invoke-virtual {v1}, Lcom/xiaomi/notes/CustomCheckListEditText;->requestFocus()Z

    .line 113
    if-nez v0, :cond_1

    .line 114
    invoke-virtual {v1}, Lcom/xiaomi/notes/CustomCheckListEditText;->getText()Landroid/text/Editable;

    move-result-object v2

    const/4 v3, 0x0

    invoke-static {v2, v3}, Landroid/text/Selection;->setSelection(Landroid/text/Spannable;I)V

    goto :goto_0

    .line 116
    :cond_1
    invoke-virtual {v1}, Lcom/xiaomi/notes/CustomCheckListEditText;->getText()Landroid/text/Editable;

    move-result-object v2

    invoke-virtual {v1}, Lcom/xiaomi/notes/CustomCheckListEditText;->getText()Landroid/text/Editable;

    move-result-object v3

    invoke-interface {v3}, Landroid/text/Editable;->length()I

    move-result v3

    invoke-static {v2, v3}, Landroid/text/Selection;->setSelection(Landroid/text/Spannable;I)V

    goto :goto_0

    .line 102
    nop

    :pswitch_data_0
    .packed-switch 0x43
        :pswitch_0
    .end packed-switch
.end method

.method public onTextChanged(Ljava/lang/CharSequence;III)V
    .locals 12
    .parameter "s"
    .parameter "start"
    .parameter "before"
    .parameter "count"

    .prologue
    .line 128
    invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v6

    .line 130
    .local v6, str:Ljava/lang/String;
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    if-eqz v7, :cond_0

    .line 131
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v7}, Lcom/xiaomi/notes/NoteEditActivity;->getWindow()Landroid/view/Window;

    move-result-object v7

    const/16 v8, 0x15

    invoke-virtual {v7, v8}, Landroid/view/Window;->setSoftInputMode(I)V

    .line 134
    invoke-static {v6}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v7

    if-eqz v7, :cond_2

    .line 135
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v8, 0x4

    invoke-virtual {v7, v8}, Landroid/widget/ImageView;->setVisibility(I)V

    .line 141
    :cond_0
    :goto_0
    const-string v7, "\n"

    invoke-virtual {v6, v7}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v7

    if-gez v7, :cond_3

    .line 171
    :cond_1
    :goto_1
    return-void

    .line 137
    :cond_2
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v8, 0x0

    invoke-virtual {v7, v8}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_0

    .line 144
    :cond_3
    const-string v7, "\n"

    invoke-virtual {v6, v7}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v5

    .line 145
    .local v5, position:I
    const-string v7, "\n"

    invoke-virtual {v6, v7}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v3

    .line 146
    .local v3, items:[Ljava/lang/String;
    array-length v4, v3

    .line 148
    .local v4, nums:I
    const/4 v7, 0x1

    if-ne v4, v7, :cond_5

    .line 149
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v7, p0}, Lcom/xiaomi/notes/NoteEditActivity;->getChildViewIndex(Landroid/view/View;)I

    move-result v2

    .line 150
    .local v2, index:I
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    const-string v8, " "

    const/4 v9, 0x0

    const/4 v10, 0x0

    add-int/lit8 v11, v2, 0x1

    invoke-virtual {v7, v8, v9, v10, v11}, Lcom/xiaomi/notes/NoteEditActivity;->insertChildView(Ljava/lang/String;ZZI)Lcom/xiaomi/notes/CustomCheckListEditText;

    move-result-object v0

    .line 151
    .local v0, edit:Lcom/xiaomi/notes/CustomCheckListEditText;
    invoke-virtual {v0}, Lcom/xiaomi/notes/CustomCheckListEditText;->requestFocus()Z

    .line 162
    .end local v0           #edit:Lcom/xiaomi/notes/CustomCheckListEditText;
    .end local v2           #index:I
    :cond_4
    const/4 v7, 0x0

    invoke-virtual {v6, v7, v5}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v6

    .line 163
    invoke-virtual {p0, v6}, Lcom/xiaomi/notes/CustomCheckListEditText;->setText(Ljava/lang/CharSequence;)V

    .line 164
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    if-eqz v7, :cond_1

    .line 165
    invoke-static {v6}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v7

    if-eqz v7, :cond_7

    .line 166
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v8, 0x4

    invoke-virtual {v7, v8}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_1

    .line 153
    :cond_5
    const/4 v1, 0x1

    .local v1, i:I
    :goto_2
    if-ge v1, v4, :cond_4

    .line 154
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v7, p0}, Lcom/xiaomi/notes/NoteEditActivity;->getChildViewIndex(Landroid/view/View;)I

    move-result v2

    .line 155
    .restart local v2       #index:I
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    aget-object v8, v3, v1

    const/4 v9, 0x0

    const/4 v10, 0x0

    add-int/lit8 v11, v2, 0x1

    invoke-virtual {v7, v8, v9, v10, v11}, Lcom/xiaomi/notes/NoteEditActivity;->insertChildView(Ljava/lang/String;ZZI)Lcom/xiaomi/notes/CustomCheckListEditText;

    move-result-object v0

    .line 157
    .restart local v0       #edit:Lcom/xiaomi/notes/CustomCheckListEditText;
    const/4 v7, 0x1

    sub-int v7, v4, v7

    if-ne v1, v7, :cond_6

    .line 158
    invoke-virtual {v0}, Lcom/xiaomi/notes/CustomCheckListEditText;->requestFocus()Z

    .line 153
    :cond_6
    add-int/lit8 v1, v1, 0x1

    goto :goto_2

    .line 168
    .end local v0           #edit:Lcom/xiaomi/notes/CustomCheckListEditText;
    .end local v1           #i:I
    .end local v2           #index:I
    :cond_7
    iget-object v7, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    const/4 v8, 0x0

    invoke-virtual {v7, v8}, Landroid/widget/ImageView;->setVisibility(I)V

    goto :goto_1
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 2
    .parameter "event"

    .prologue
    .line 80
    invoke-virtual {p1}, Landroid/view/MotionEvent;->getAction()I

    move-result v0

    packed-switch v0, :pswitch_data_0

    .line 97
    :goto_0
    :pswitch_0
    invoke-super {p0, p1}, Landroid/widget/EditText;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    return v0

    .line 82
    :pswitch_1
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v0}, Lcom/xiaomi/notes/NoteEditActivity;->getWindow()Landroid/view/Window;

    move-result-object v0

    const/16 v1, 0x15

    invoke-virtual {v0, v1}, Landroid/view/Window;->setSoftInputMode(I)V

    .line 85
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    invoke-virtual {v0}, Lcom/xiaomi/notes/NoteEditActivity;->getState()I

    move-result v0

    packed-switch v0, :pswitch_data_1

    goto :goto_0

    .line 88
    :pswitch_2
    iget-object v0, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/xiaomi/notes/NoteEditActivity;->setState(I)V

    goto :goto_0

    .line 80
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_1
        :pswitch_0
        :pswitch_0
    .end packed-switch

    .line 85
    :pswitch_data_1
    .packed-switch 0x1
        :pswitch_2
        :pswitch_2
    .end packed-switch
.end method

.method public setActivity(Lcom/xiaomi/notes/NoteEditActivity;)V
    .locals 0
    .parameter "activity"

    .prologue
    .line 39
    iput-object p1, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->activity:Lcom/xiaomi/notes/NoteEditActivity;

    .line 40
    return-void
.end method

.method public setCheckFlag(Z)V
    .locals 1
    .parameter "flag"

    .prologue
    .line 47
    if-eqz p1, :cond_0

    .line 48
    const/high16 v0, -0x67

    invoke-virtual {p0, v0}, Lcom/xiaomi/notes/CustomCheckListEditText;->setTextColor(I)V

    .line 52
    :goto_0
    iput-boolean p1, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->blnCheckFlag:Z

    .line 53
    return-void

    .line 50
    :cond_0
    const v0, -0xb4b4b5

    invoke-virtual {p0, v0}, Lcom/xiaomi/notes/CustomCheckListEditText;->setTextColor(I)V

    goto :goto_0
.end method

.method public setImageCheck(Landroid/widget/ImageView;)V
    .locals 0
    .parameter "obj"

    .prologue
    .line 43
    iput-object p1, p0, Lcom/xiaomi/notes/CustomCheckListEditText;->objCheck:Landroid/widget/ImageView;

    .line 44
    return-void
.end method
